<template>
  <div class="container">
    <header class="header">
      <h1 class="title">{{ getTitle() }}</h1>
      <div class="title-time">
        <span>2025-10-24 09:00</span>
      </div>
    </header>

    <!-- 分隔线 -->
    <div class="divider"></div>

    <!-- 内容区域 -->
    <main class="content">
      <CarUnitOverView />
    </main>
  </div>
</template>

<script>
import CarUnitOverView from "@/views/stats/CarUnitStats/CarUnitOverView.vue";

export default {
  components: {
    CarUnitOverView
  },
  props: {
    data: {
      type: Object,
      required: true,
      default: () => ({})
    }
  },
  data() {
    return {

    }
  },
  methods: {
    // 根据mode获取对应的标题
    getTitle() {
      const { mode } = this.data;
      switch (mode) {
        case 'dutyCarUnit':
          return '值班车组';
        case 'taskCarUnit':
          return '任务车组';
        case 'standByUnit':
          return '待命车组';
        case 'stopUsedUnit':
          return '暂停调用';
        default:
          return '';
      }
    }
  }
}
</script>

<style scoped>
.container {
  width: 100%;
  min-height: 100vh;
  box-sizing: border-box;
  padding: 0 10px;
}

.header {
  display: flex;
  align-items: center;
  padding: 4px 0;
  gap: 25px;
  flex-wrap: wrap;
}

.title {
  margin: 0;
  font-size: 15px;
  color: rgba(0, 0, 0, 0.80);
  padding: 3px 30px 3px 20px;
  position: relative;
  display: inline-flex;
  align-items: center;
  /* 关键：让背景和边框形状一致 */
  clip-path: polygon(
      0 0,
      calc(100% - 15px) 0,
      100% 100%,
      0 100%
  );
  background-color: #3DE7C9;
}

/* 右侧和上下边框 */
.title::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-style: solid;
  border-color: #3DE7C9;
  border-width: 1px 1px 1px 0; /* 左侧边框已单独设置 */
  clip-path: polygon(
      0 0,
      calc(100% - 8px) 0,
      100% 100%,
      0 100%
  );
  pointer-events: none;
}

.title-time {
  font-size: 14px;
  line-height: 14px;
}

.divider {
  height: 1px;
  width: 100%;
  background-color: #3DE7C9;
  margin: 2px 0 10px;
}

.content {
  width: 100%;
  min-height: 400px;
  padding: 10px;
  box-sizing: border-box;
  border-radius: 4px;
}
</style>
<style lang="scss" scoped>

</style>
